package com.emergency.examine.domain;

import com.emergency.base.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

//考试表，记录考试状态
@Entity
@Table(name = "ex_exam")
public class Exam extends BaseEntity {

    private String name;//考试名称

    private String type;//考试类型，枚举，暂为string

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date starttime;//开始时间

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endtime;//结束时间

    private Double duration;//持续时间，秒

    @OneToOne(targetEntity = Paper.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "paper_id", referencedColumnName = "id")
    private Paper paper; //试卷id(试题表)

    @OneToOne(targetEntity = ExamStaff.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "staff_id", referencedColumnName = "id")
    private ExamStaff examStaff; //参与考试考生id(考生表)

    /**
     * 考生答题
     */
    @Transient
    private List<ExamAnswer> examAnswer;

    /**
     * 考生题目得分 改成list
     */
    @Transient
    private List<QuestionScore> questionScore;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Date getStarttime() {
        return starttime;
    }

    public void setStarttime(Date starttime) {
        this.starttime = starttime;
    }

    public Date getEndtime() {
        return endtime;
    }

    public void setEndtime(Date endtime) {
        this.endtime = endtime;
    }

    public Double getDuration() {
        return duration;
    }

    public void setDuration(Double duration) {
        this.duration = duration;
    }

    public Paper getPaper() {
        return paper;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public ExamStaff getExamStaff() {
        return examStaff;
    }

    public void setExamStaff(ExamStaff examStaff) {
        this.examStaff = examStaff;
    }

    public List<ExamAnswer> getExamAnswer() {
        return examAnswer;
    }

    public void setExamAnswer(List<ExamAnswer> examAnswer) {
        this.examAnswer = examAnswer;
    }

    public List<QuestionScore> getQuestionScore() {
        return questionScore;
    }

    public void setQuestionScore(List<QuestionScore> questionScore) {
        this.questionScore = questionScore;
    }
}
